package com.neusoft.neuiotms.dcam.fixed.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractModel;
import com.neusoft.bizcore.web.jpa.model.Comment;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 资产分类
 */
@Getter
@Setter
@ToString
@Entity
@Table(name = "neuiot_fixed_asset_type")
@org.hibernate.annotations.Table(appliesTo = "neuiot_fixed_asset_type", comment = "固定资产分类表")
public class AssetType extends AbstractModel {

    private static final long serialVersionUID = 1L;

    /** 资产分类名 */
    @NotBlank(message = "固定资产分类名不能为空")
    @Length(max = 50, message = "固定资产分类名不能超过{max}位")
    @Column(length = 50)
    @Comment("varchar(50) NOT NULL COMMENT '名称'")
    private String name;

    /** 资产分类编码 */
    @NotBlank(message = "固定资产分类编码不能为空")
    @Length(max = 50, message = "固定资产分类编码不能超过{max}位")
    @Column(length = 50, unique = true)
    @Comment("varchar(50) NOT NULL COMMENT '编码'")
    private String code;

    @Comment("int(11) NULL COMMENT '排序'")
    private int sort = -1;

    @ManyToOne
    @Comment("bigint(20) NOT NULL COMMENT '父分类 id'")
    private AssetType parent;

    /** 计量单位 */
    @Length(max = 10, message = "计量单位不能超过{max}位")
    @Comment("varchar(10) NULL DEFAULT NULL COMMENT '计量单位'")
    private String measureUnit;

}
